<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
Caesar (JGenere - Initial Port v0.3 r2010.1105)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Caesar (JGenere - Initial Port v0.3 r2010.1105)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM></TD></TR><TR><TD COLSPAN=3><hr />Note: While the cryptography implementations in jgenere.initial_port work correctly according to the provided test cases, they were not optimized or otherwise designed to make use of Java language and platform features.  They are simple ports of the original Python implementation of PyGenere, provided for academic purposes.  Visit the project web site at <a target=_blank href=http://code.google.com/p/jgenere/>http://code.google.com/p/jgenere/</a> for preferred Java-based implementations of these cryptography algorithms.<hr /></TD></TR></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html" title="class in ttpasi.jgenere.initial_port"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?ttpasi/jgenere/initial_port/Caesar.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Caesar.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
ttpasi.jgenere.initial_port</FONT>
<BR>
Class Caesar</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>ttpasi.jgenere.initial_port.Caesar</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.97"><B>Caesar</B></A><DT>extends java.lang.Object</DL>
</PRE>

<P>
Java port of Caesar cipher from PyGenere v 0.3.  See pygenere.py to learn  
 more about the original PyGenere implementation, including author contact 
 information and licensing and use terms.
 <p/>
 Caesar objects can encipher and decipher English alphabet text messages.  See 
 <a target="_blank" href="http://en.wikipedia.org/wiki/Caesar_cipher">http://en.wikipedia.org/wiki/Caesar_cipher</a> 
 for more information on how the Caesar cipher works.
 <p/>
 Caesar objects are immutable. Calls to the encryption algorithms encipher and 
 decipher return new Caesar objects with the internal message shifted as 
 specified.
 <p/>
 This typical use sequence to encrypt a message
 <pre>
 String plaintext = "The quick brown fox jumps over the lazy dog.";
 Caesar caesar = new Caesar(plaintext);
 String ciphertext = caesar.encipher(5).text();
 System.out.println(ciphertext);
 </pre>
 outputs
 <pre>
 Ymj vznhp gwtbs ktc ozrux tajw ymj qfed itl.
 </pre>
 This typical use sequence to decrypt a message
 <pre>
 String ciphertext = "Ymj vznhp gwtbs ktc ozrux tajw ymj qfed itl.";
 Caesar caesar = new Caesar(ciphertext);
 String plaintext = caesar.decipher(5).text();
 System.out.println(plaintext);
 </pre>
 outputs
 <pre>
 The quick brown fox jumps over the lazy dog.
 </pre>
 See jgenere.initial_port.CaesarEncipherDecipherTest source code for further 
 example uses. 
 <p/>
 Note: While the cryptography implementations in jgenere.initial_port work 
 correctly according to the provided test cases, they were not optimized or 
 otherwise designed to make use of Java language and platform features.  They 
 are simple ports of the original Python implementation of PyGenere, provided 
 for academic purposes.  Visit the project web site at 
 <a target="_blank" href="http://code.google.com/p/jgenere/">http://code.google.com/p/jgenere/</a> 
 for preferred Java-based implementations of these cryptography algorithms.
 <p/>
 The original PyGenere v 0.3 Caesar code:
 <pre>
 class Caesar(str):
 
   """An implementation of the Caesar cipher."""
 
   def encipher(self, shift):
       """Encipher input (plaintext) using the Caesar cipher and return it
          (ciphertext)."""
       ciphertext = []
       for p in self:
           if p.isalpha():
               ciphertext.append(chr((ord(p) - ord('Aa'[int(p.islower())]) +
               shift) % 26 + ord('Aa'[int(p.islower())])))
           else:
               ciphertext.append(p)
       return Caesar(''.join(ciphertext))
 
   def decipher(self, shift):
       """Decipher input (ciphertext) using the Caesar cipher and return it
          (plaintext)."""
       return self.encipher(-shift)
 </pre>
<P>

<P>
<DL>
<DT><B>Version:</B></DT>
  <DD>2010.1105</DD>
<DT><B>Author:</B></DT>
  <DD>Bruce [com.gmail @ ProgrammerBruce]</DD>
</DL>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#Caesar(java.lang.String)">Caesar</A></B>(java.lang.String&nbsp;text)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new Caesar with a text message to be enciphered or deciphered.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port">Caesar</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#decipher(int)">decipher</A></B>(int&nbsp;backshift)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Deciphers (i.e., decrypts) the internal text message, backshifted (i.e., 
 backwards shifted) by the amount specified.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port">Caesar</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#encipher(int)">encipher</A></B>(int&nbsp;shift)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enciphers (i.e., encrypts) the internal text message, shifted by the amount 
 specified.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#text()">text</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the internal English alphabet text message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#toString()">toString</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the internal English alphabet text message.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="Caesar(java.lang.String)"><!-- --></A><H3>
Caesar</H3>
<PRE>
public <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.109"><B>Caesar</B></A>(java.lang.String&nbsp;text)</PRE>
<DL>
<DD>Constructs a new Caesar with a text message to be enciphered or deciphered.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - The text message to encipher or decipher.</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="encipher(int)"><!-- --></A><H3>
encipher</H3>
<PRE>
public <A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port">Caesar</A> <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.126"><B>encipher</B></A>(int&nbsp;shift)</PRE>
<DL>
<DD>Enciphers (i.e., encrypts) the internal text message, shifted by the amount 
 specified.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>shift</CODE> - Distance along English alphabet to shift the message.
<DT><B>Returns:</B><DD>New Caesar object with the enciphered message.</DL>
</DD>
</DL>
<HR>

<A NAME="decipher(int)"><!-- --></A><H3>
decipher</H3>
<PRE>
public <A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port">Caesar</A> <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.171"><B>decipher</B></A>(int&nbsp;backshift)</PRE>
<DL>
<DD>Deciphers (i.e., decrypts) the internal text message, backshifted (i.e., 
 backwards shifted) by the amount specified.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>backshift</CODE> - Distance along English alphabet to backwards shift the 
            message.
<DT><B>Returns:</B><DD>New Caesar object with the deciphered message.</DL>
</DD>
</DL>
<HR>

<A NAME="text()"><!-- --></A><H3>
text</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.183"><B>text</B></A>()</PRE>
<DL>
<DD>Retrieves the internal English alphabet text message.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>The internal English alphabet text message.</DL>
</DD>
</DL>
<HR>

<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/Caesar.html#line.195"><B>toString</B></A>()</PRE>
<DL>
<DD>Retrieves the internal English alphabet text message.  Same behavior as 
 <A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html#text()"><CODE>text()</CODE></A>.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>The internal English alphabet text message.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM></TD></TR><TR><TD COLSPAN=3><hr />Note: While the cryptography implementations in jgenere.initial_port work correctly according to the provided test cases, they were not optimized or otherwise designed to make use of Java language and platform features.  They are simple ports of the original Python implementation of PyGenere, provided for academic purposes.  Visit the project web site at <a target=_blank href=http://code.google.com/p/jgenere/>http://code.google.com/p/jgenere/</a> for preferred Java-based implementations of these cryptography algorithms.<hr /></TD></TR></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html" title="class in ttpasi.jgenere.initial_port"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?ttpasi/jgenere/initial_port/Caesar.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Caesar.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>
